<?php
	session_start();
	function P($arg){
		echo "<pre>";
		print_r($arg);
		echo "</pre>";
	}
	function C($name=null,$value=null){
		static $config=array();
		if(is_null($name)){
			return $config;
		}
		if(is_string($name)){
			if(is_null($value)){
				return $config[$name];
			}else{
				return isset($config[$name])?$config[$name]=$value:false;
			}			
		}
		if(is_array($name)){
			$config=array_merge($config,$name);
			return $config;
		}
	}
	function loadFile($file){
		static $loadFiles=array();
		$mfile=md5($file);
		if(is_file($file)){
			if(isset($loadFiles[$mfile])){
				return true;
			}
			include $file;
			$loadFiles[$mfile]=true;
			return true;
		}
		return false;
	}
	function __autoload($classname){
		if(strlen($classname)>7 && (substr($classname, -7)=="Control")){
			$file=PATH_APP.'/control/'.$classname.'.php';
		}else{
			$file=PATH_XD.'/bin/'.$classname.".class.php";
		}
		if(is_file($file)){
			loadFile($file);
			return true;
		}else{
		
			die($file."文件不存在！");
		}
	}
?>